package com.example.batterynotification;

import android.appwidget.AppWidgetManager;
import android.content.ComponentName;
import android.content.Context;
import android.widget.RemoteViews;

public class AppWidgetProvider extends android.appwidget.AppWidgetProvider{

	
	@Override
	public void onUpdate(Context context, AppWidgetManager appWidgetManager,
			int[] appWidgetIds) {
		// initializing widget layout
		RemoteViews remoteViews = new RemoteViews(context.getPackageName(),R.layout.widget_layout);
		
//		// updating view with initial data
//		remoteViews.setTextViewText(R.id.title, getTitle());
//		remoteViews.setTextViewText(R.id.desc, getDesc());
//
//		// request for widget update
    	pushWidgetUpdate(context, remoteViews);
	}

	public static void pushWidgetUpdate(Context context, RemoteViews remoteViews) {
		ComponentName myWidget = new ComponentName(context,
				AppWidgetProvider.class);
		AppWidgetManager manager = AppWidgetManager.getInstance(context);
		manager.updateAppWidget(myWidget, remoteViews);
	}
}
